$(function(){
	var $winH = $(window).height();
	var $img = $("img[original]");
	var $imgH = parseInt($img.height()/2);//图片到一半的时候显示
	var finished = true;
	runing();
	if($("img[original]").size()>0){
		$(window).scroll(function(){
			if(finished ) {
					finished = false;
					runing();
			}
		});
	}
	function runing(){
		$winH = $(window).height();
		$img.each(function(i){
			var $src = $img.eq(i).attr("original");
			var $scroTop = $img.eq(i).offset();
			if($scroTop.top + $imgH >= $(window).scrollTop() && $(window).scrollTop() + $winH >= $scroTop.top + $imgH){//判断窗口至上往下的位置
				$img.eq(i).attr("src",function(){return $src}).fadeIn(300);//元素属性交换
			}
		});
		finished = true;
	}
});